<template>
  <div class="bin-location-container">
    <!-- 页面头部 -->
    <el-page-header @back="goBack" class="page-header">
      <template #content>
        <span class="header-title">库位设置</span>
      </template>
    </el-page-header>

    <!-- 搜索区域 -->
    <div class="search-card">
      <el-form :inline="true" class="search-form">
        <div class="search-row">
          <el-form-item label="库位编号">
            <el-input
              v-model="sreach.binLocationCode"
              placeholder="请输入库位编号"
              clearable
              class="search-input"
            >
              <template #prefix>
                <el-icon><Location /></el-icon>
              </template>
            </el-input>
          </el-form-item>
          <el-form-item label="库位名称">
            <el-input
              v-model="sreach.binLocationName"
              placeholder="请输入库位名称"
              clearable
              class="search-input"
            >
              <template #prefix>
                <el-icon><Edit /></el-icon>
              </template>
            </el-input>
          </el-form-item>
        </div>
        <div class="search-row location-row">
          <el-form-item label="库位位置" class="location-item">
            <div class="location-inputs">
              <div class="location-input-group">
                <el-input-number 
                  v-model="sreach.locationX" 
                  :controls="false"
                  class="location-input" 
                  :min="0" 
                  :max="1000000"
                />
                <div class="input-controls">
                  <el-button class="control-btn minus-btn" @click="handleLocationChange('locationX', -100)">
                    <el-icon><Minus /></el-icon>
                  </el-button>
                  <el-button class="control-btn plus-btn" @click="handleLocationChange('locationX', 100)">
                    <el-icon><Plus /></el-icon>
                  </el-button>
                </div>
              </div>
              <div class="location-input-group">
                <el-input-number 
                  v-model="sreach.locationY" 
                  :controls="false"
                  class="location-input" 
                  :min="0" 
                  :max="1000000"
                />
                <div class="input-controls">
                  <el-button class="control-btn minus-btn" @click="handleLocationChange('locationY', -100)">
                    <el-icon><Minus /></el-icon>
                  </el-button>
                  <el-button class="control-btn plus-btn" @click="handleLocationChange('locationY', 100)">
                    <el-icon><Plus /></el-icon>
                  </el-button>
                </div>
              </div>
              <div class="location-input-group">
                <el-input-number 
                  v-model="sreach.locationZ" 
                  :controls="false"
                  class="location-input" 
                  :min="0" 
                  :max="1000000"
                />
                <div class="input-controls">
                  <el-button class="control-btn minus-btn" @click="handleLocationChange('locationZ', -100)">
                    <el-icon><Minus /></el-icon>
                  </el-button>
                  <el-button class="control-btn plus-btn" @click="handleLocationChange('locationZ', 100)">
                    <el-icon><Plus /></el-icon>
                  </el-button>
                </div>
              </div>
            </div>
          </el-form-item>
        </div>
        <div class="search-row button-row">
          <el-button type="primary" @click="funShow" :loading="loading">
            <el-icon><Search /></el-icon>查询
          </el-button>
          <el-button @click="resetSearch">
            <el-icon><Refresh /></el-icon>重置
          </el-button>
        </div>
      </el-form>
    </div>

    <!-- 表格区域 -->
    <div class="table-card">
      <div class="card-header">
        <div class="header-title">
          <el-icon><List /></el-icon>
          库位列表
        </div>
        <el-button type="primary" @click="OpenAdd" class="add-button">
          <el-icon><Plus /></el-icon>新增库位
        </el-button>
      </div>
      
      <el-table 
        v-loading="loading"
        :data="tableData" 
        border 
        stripe
        highlight-current-row
        style="width: 1370px"
        class="data-table"
        :header-cell-style="{
          background: '#f5f7fa',
          color: '#606266',
          height: '50px',
          fontWeight: '600'
        }"
        :cell-style="{
          padding: '12px',
          fontSize: '14px'
        }"
      >
        <el-table-column prop="binLocationCode" label="库位编号" min-width="120" show-overflow-tooltip>
          <template #default="scope">
            <span class="location-code">{{ scope.row.binLocationCode }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="binLocationName" label="库位名称" min-width="120" show-overflow-tooltip>
          <template #default="scope">
            <span class="location-name">{{ scope.row.binLocationName }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="area" label="面积" min-width="100" align="right">
          <template #default="scope">
            <span class="numeric-value">{{ scope.row.area }} m²</span>
          </template>
        </el-table-column>
        <el-table-column prop="maximum" label="最大载重量" min-width="120" align="right">
          <template #default="scope">
            <span class="numeric-value">{{ scope.row.maximum }} kg</span>
          </template>
        </el-table-column>
        <el-table-column label="库位位置" min-width="220">
          <template #default="scope">
            <div class="location-coordinates">
              <el-tag size="small" type="info" effect="plain">X: {{ scope.row.locationX }}</el-tag>
              <el-tag size="small" type="info" effect="plain">Y: {{ scope.row.locationY }}</el-tag>
              <el-tag size="small" type="info" effect="plain">Z: {{ scope.row.locationZ }}</el-tag>
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="isProductsMix" label="允许产品混放" width="120" align="center">
          <template #default="scope">
            <el-tag :type="scope.row.isProductsMix === 0 ? 'success' : 'danger'" effect="dark">
              {{ scope.row.isProductsMix === 0 ? '是' : '否' }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="isBatchMix" label="允许批次混放" width="120" align="center">
          <template #default="scope">
            <el-tag :type="scope.row.isBatchMix === 0 ? 'success' : 'danger'" effect="dark">
              {{ scope.row.isBatchMix === 0 ? '是' : '否' }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="isLock" label="是否启用" width="100" align="center">
          <template #default="scope">
            <el-tag :type="scope.row.isLock === 0 ? 'success' : 'danger'" effect="dark">
              {{ scope.row.isLock === 0 ? '是' : '否' }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="isFreeze" label="是否冻结" width="180" align="center">
          <template #default="scope">
            <el-switch
              v-model="scope.row.isFreeze"
              :active-value="1"
              :inactive-value="0"
              active-text="已冻结"
              inactive-text="未冻结"
              :loading="scope.row.freezeLoading"
              @change="(val) => handleFreezeChange(val, scope.row)"
              class="freeze-switch"
            />
          </template>
        </el-table-column>
        <el-table-column label="操作" width="180" fixed="right" align="center">
          <template #default="scope">
            <div class="operation-buttons">
              <el-button type="primary" link @click="handleEdit(scope.row)">
                <el-icon><Edit /></el-icon>编辑
              </el-button>
              <el-divider direction="vertical" />
              <el-button type="danger" link @click="handleDelete(scope.row)">
                <el-icon><Delete /></el-icon>删除
              </el-button>
            </div>
          </template>
        </el-table-column>
      </el-table>

      <!-- 分页器 -->
      <div class="pagination-container">
        <el-pagination
          v-model:current-page="page.pageIndex"
          v-model:page-size="page.pageSize"
          :page-sizes="[10, 20, 50, 100]"
          :background="true"
          layout="total, sizes, prev, pager, next, jumper"
          :total="page.totalCount"
        />
      </div>
    </div>

    <!-- 新增/编辑对话框 -->
    <el-dialog 
      v-model="dialogFormVisible" 
      :title="form.id ? '编辑库位信息' : '新增库位信息'" 
      width="800px"
      destroy-on-close
      :close-on-click-modal="false"
      class="custom-dialog"
    >
      <el-form 
        :model="form"
        :rules="rules"
        ref="formRef"
        label-width="100px"
        class="custom-form"
        :validate-on-rule-change="false"
      >
        <div class="form-section">
          <div class="section-title">基本信息</div>
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="库位编号" prop="binLocationCode">
                <el-input 
                  v-model="form.binLocationCode" 
                  placeholder="请输入库位编号"
                  :maxlength="20"
                  show-word-limit
                >
                  <template #prefix>
                    <el-icon><Location /></el-icon>
                  </template>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="库位名称" prop="binLocationName">
                <el-input 
                  v-model="form.binLocationName" 
                  placeholder="请输入库位名称"
                  :maxlength="50"
                  show-word-limit
                >
                  <template #prefix>
                    <el-icon><Edit /></el-icon>
                  </template>
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="面积" prop="area">
                <el-input-number 
                  v-model="form.area" 
                  :min="0"
                  :precision="2"
                  :step="10"
                  style="width: 100%"
                  placeholder="请输入面积"
                >
                  <template #suffix>m²</template>
                </el-input-number>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="最大载重量" prop="maximum">
                <el-input-number 
                  v-model="form.maximum" 
                  :min="0"
                  :precision="2"
                  :step="100"
                  style="width: 100%"
                  placeholder="请输入最大载重量"
                >
                  <template #suffix>kg</template>
                </el-input-number>
              </el-form-item>
            </el-col>
          </el-row>
        </div>

        <div class="form-section">
          <div class="section-title">位置信息</div>
          <el-row :gutter="20">
            <el-col :span="8">
              <el-form-item label="位置 X" prop="locationX">
                <el-input-number 
                  v-model="form.locationX" 
                  :min="0"
                  controls-position="right"
                  style="width: 100%"
                  placeholder="X 坐标"
                />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="位置 Y" prop="locationY">
                <el-input-number 
                  v-model="form.locationY" 
                  :min="0"
                  controls-position="right"
                  style="width: 100%"
                  placeholder="Y 坐标"
                />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="位置 Z" prop="locationZ">
                <el-input-number 
                  v-model="form.locationZ" 
                  :min="0"
                  controls-position="right"
                  style="width: 100%"
                  placeholder="Z 坐标"
                />
              </el-form-item>
            </el-col>
          </el-row>
        </div>

        <div class="form-section">
          <div class="section-title">状态设置</div>
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="是否启用" prop="isLock">
                <el-radio-group v-model="form.isLock">
                  <el-radio :value="0" class="custom-radio">
                    <el-icon class="radio-icon" color="#67c23a"><Select /></el-icon>
                    启用
                  </el-radio>
                  <el-radio :value="1" class="custom-radio">
                    <el-icon class="radio-icon" color="#f56c6c"><Close /></el-icon>
                    禁用
                  </el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="是否冻结" prop="isFreeze">
                <el-switch
                  v-model="form.isFreeze"
                  active-text="已冻结"
                  inactive-text="未冻结"
                  :active-value="1"
                  :inactive-value="0"
                  style="width: 100%"
                  class="status-switch"
                />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="允许混放" prop="isProductsMix">
                <el-radio-group v-model="form.isProductsMix">
                  <el-radio :value="0" class="custom-radio">
                    <el-icon class="radio-icon" color="#67c23a"><Select /></el-icon>
                    允许
                  </el-radio>
                  <el-radio :value="1" class="custom-radio">
                    <el-icon class="radio-icon" color="#f56c6c"><Close /></el-icon>
                    不允许
                  </el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="批次混放" prop="isBatchMix">
                <el-radio-group v-model="form.isBatchMix">
                  <el-radio :value="0" class="custom-radio">
                    <el-icon class="radio-icon" color="#67c23a"><Select /></el-icon>
                    允许
                  </el-radio>
                  <el-radio :value="1" class="custom-radio">
                    <el-icon class="radio-icon" color="#f56c6c"><Close /></el-icon>
                    不允许
                  </el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
          </el-row>
        </div>

        <div class="form-section">
          <div class="section-title">其他信息</div>
          <el-form-item label="备注" prop="descs">
            <el-input 
              type="textarea" 
              v-model="form.descs" 
              placeholder="请输入备注信息"
              :rows="3"
              :maxlength="200"
              show-word-limit
            />
          </el-form-item>
        </div>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="dialogFormVisible = false">取消</el-button>
          <el-button type="primary" @click="handleSave" :loading="saveLoading">
            {{ form.id ? '保存修改' : '确认新增' }}
          </el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script lang="ts" setup>
import { ref, reactive, onMounted, watch } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import type { FormInstance, MessageBoxState } from 'element-plus'
import { 
  Search, 
  Refresh, 
  Plus, 
  Edit, 
  Delete, 
  List, 
  Location,
  Select,
  Close,
  Position,
  Minus 
} from '@element-plus/icons-vue'
import axios from 'axios'
import http from '@/api/http'
import { useRouter, useRoute } from 'vue-router'

const router = useRouter()
const route = useRoute()
const formRef = ref<FormInstance>()

// 加载状态
const loading = ref(false)
const saveLoading = ref(false)

// 查询条件
const sreach = reactive({
  reservoirAreaCode: route.query.reservoirAreaCode,
  binLocationCode: '',
  binLocationName: '',
  locationX: 0,
  locationY: 0,
  locationZ: 0
})

// 分页条件
const page = reactive({
  pageIndex: 1,
  pageSize: 10,
  totalCount: 0,
  totalPage: 0
})

// 表单校验规则
const rules = {
  binLocationCode: [
    { required: true, message: '请输入库位编号', trigger: 'blur' },
    { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' }
  ],
  binLocationName: [
    { required: true, message: '请输入库位名称', trigger: 'blur' },
    { min: 2, max: 50, message: '长度在 2 到 50 个字符', trigger: 'blur' }
  ],
  area: [
    { required: true, message: '请输入面积', trigger: 'blur' },
    { type: 'number', min: 0, message: '面积必须大于等于0', trigger: 'blur' }
  ],
  maximum: [
    { required: true, message: '请输入最大载重量', trigger: 'blur' },
    { type: 'number', min: 0, message: '最大载重量必须大于等于0', trigger: 'blur' }
  ],
  locationX: [
    { required: true, message: '请输入X坐标', trigger: 'blur' },
    { type: 'number', min: 0, message: 'X坐标必须大于等于0', trigger: 'blur' }
  ],
  locationY: [
    { required: true, message: '请输入Y坐标', trigger: 'blur' },
    { type: 'number', min: 0, message: 'Y坐标必须大于等于0', trigger: 'blur' }
  ],
  locationZ: [
    { required: true, message: '请输入Z坐标', trigger: 'blur' },
    { type: 'number', min: 0, message: 'Z坐标必须大于等于0', trigger: 'blur' }
  ]
}

// 表单数据
const form = reactive({
  id: 0,
  binLocationCode: '',
  binLocationName: '',
  area: 0,
  maximum: 0,
  locationX: 0,
  locationY: 0,
  locationZ: 0,
  isProductsMix: 0,
  isBatchMix: 0,
  isLock: 0,
  isFreeze: 0,
  descs: '',
  reservoirAreaCode: route.query.reservoirAreaCode
})

// 表格数据
const tableData = ref([])

// 获取数据列表
const funShow = async () => {
  try {
    loading.value = true
    const res = await axios.get('http://localhost:9991/api/WarehouseManagement/GetBinLocationPageList', {
      params: {
        pageIndex: page.pageIndex,
        pageSize: page.pageSize,
        reservoirAreaCode: sreach.reservoirAreaCode,
        binLocationCode: sreach.binLocationCode,
        binLocationName: sreach.binLocationName,
        locationX: sreach.locationX,
        locationY: sreach.locationY,
        locationZ: sreach.locationZ
      }
    })
    tableData.value = res.data.data
    page.totalCount = res.data.totalCount
    page.totalPage = res.data.totalPages
  } catch (error: any) {
    ElMessage.error('获取数据失败：' + error.message)
  } finally {
    loading.value = false
  }
}

// 重置搜索
const resetSearch = () => {
  sreach.binLocationCode = ''
  sreach.binLocationName = ''
  sreach.locationX = 0
  sreach.locationY = 0
  sreach.locationZ = 0
  page.pageIndex = 1
  funShow()
}

// 返回上一级
const goBack = () => {
  router.back()
}

// 打开新增对话框
const dialogFormVisible = ref(false)
const OpenAdd = () => {
  form.id = 0
  form.binLocationCode = ''
  form.binLocationName = ''
  form.area = 0
  form.maximum = 0
  form.locationX = 0
  form.locationY = 0
  form.locationZ = 0
  form.isProductsMix = 0
  form.isBatchMix = 0
  form.isLock = 0
  form.isFreeze = 0
  form.descs = ''
  dialogFormVisible.value = true
}

// 编辑
const handleEdit = (row:any) => {
  Object.assign(form, row)
  dialogFormVisible.value = true
}

// 删除
const handleDelete = (row: any) => {
  ElMessageBox.confirm('确认删除该库位?', '提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning',
    beforeClose: async (action: string, instance: MessageBoxState, done: () => void) => {
      if (action === 'confirm') {
        instance.confirmButtonLoading = true
        try {
          await http.post('/api/WarehouseManagement/DeleteBinLocation', row)
          ElMessage.success('删除成功')
          done()
          funShow()
        } catch (error: any) {
          ElMessage.error('删除失败：' + error.message)
        } finally {
          instance.confirmButtonLoading = false
        }
      } else {
        done()
      }
    }
  })
}

// 保存
const handleSave = async () => {
  if (!formRef.value) return
  
  try {
    await formRef.value.validate()
    saveLoading.value = true
    const api = form.id ? '/api/WarehouseManagement/UpdateBinLocation' : '/api/WarehouseManagement/CreateBinLocation'
    await http.post(api, form)
    ElMessage.success(form.id ? '编辑成功' : '新增成功')
    dialogFormVisible.value = false
    funShow()
  } catch (error: any) {
    ElMessage.error((form.id ? '编辑' : '新增') + '失败：' + error.message)
  } finally {
    saveLoading.value = false
  }
}

// 处理冻结状态变更
const handleFreezeChange = async (val: 0 | 1, row:any) => {
  try {
    row.freezeLoading = true
    await http.post('/api/WarehouseManagement/UpdateBinLocation', {
      ...row,
      isFreeze: val
    })
    ElMessage.success('更新成功')
  } catch (error: any) {
    ElMessage.error('更新失败：' + error.message)
    // 恢复原值
    row.isFreeze = val ? 0 : 1
  } finally {
    row.freezeLoading = false
  }
}

// 处理库位位置变更
const handleLocationChange = (field: 'locationX' | 'locationY' | 'locationZ', step: number) => {
  const currentValue = sreach[field] || 0
  const newValue = currentValue + step
  if (newValue >= 0 && newValue <= 1000000) {
    sreach[field] = newValue
  }
}

// 监听分页变化
watch(page, () => {
  funShow()
})

// 初始化
onMounted(() => {
  funShow()
})
</script>

<style lang="scss" scoped>
.bin-location-container {
  padding: 24px;
  background-color: #f5f7fa;
  min-height: calc(100vh - 48px);
}

.page-header {
  margin-bottom: 24px;
  background-color: #fff;
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;

  &:hover {
    box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.1);
  }

  .header-title {
    font-size: 18px;
    font-weight: 600;
    color: #303133;
  }
}

.search-card {
  margin-bottom: 24px;
  background-color: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);

  .search-form {
    .search-row {
      display: flex;
      align-items: center;
      gap: 16px;
      margin-bottom: 16px;

      &:last-child {
        margin-bottom: 0;
      }

      &.location-row {
        padding: 0;

        .location-item {
          width: 100%;
          margin-bottom: 0;

          :deep(.el-form-item__label) {
            color: #606266;
            font-weight: 500;
          }
        }

        .location-inputs {
          display: flex;
          gap: 16px;
          flex: 1;

          .location-input-group {
            position: relative;
            display: flex;
            align-items: center;
            flex: 1;

            .location-input {
              width: 100%;

              :deep(.el-input-number__wrapper) {
                padding: 0 8px;
                text-align: center;
                border: 1px solid #dcdfe6;
                border-radius: 4px;
                height: 32px;
                line-height: 32px;
                box-shadow: none;

                &:hover {
                  border-color: #409eff;
                }

                .el-input__inner {
                  text-align: center;
                  padding: 0;
                }
              }
            }

            .input-controls {
              position: absolute;
              left: 0;
              right: 0;
              top: 0;
              bottom: 0;
              display: flex;
              justify-content: space-between;
              align-items: center;
              pointer-events: none;

              .control-btn {
                height: 100%;
                padding: 0 8px;
                border: none;
                background: transparent;
                color: #606266;
                pointer-events: auto;

                &:hover {
                  color: #409eff;
                }

                &.minus-btn {
                  border-right: 1px solid #dcdfe6;
                }

                &.plus-btn {
                  border-left: 1px solid #dcdfe6;
                }

                .el-icon {
                  font-size: 12px;
                }
              }
            }
          }
        }
      }

      &.button-row {
        justify-content: center;
        padding-top: 16px;

        .el-button {
          padding: 8px 20px;

          .el-icon {
            margin-right: 4px;
          }
        }
      }
    }

    :deep(.el-form-item) {
      margin-bottom: 0;
      margin-right: 0;

      .el-form-item__label {
        font-weight: 500;
        color: #606266;
      }
    }

    .search-input {
      width: 240px;

      :deep(.el-input__wrapper) {
        box-shadow: 0 0 0 1px #dcdfe6 inset;
      }

      :deep(.el-input__prefix) {
        margin-right: 8px;

        .el-icon {
          color: #909399;
        }
      }
    }
  }
}

.table-card {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;

  &:hover {
    box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.1);
  }

  .card-header {
    padding: 20px;
    border-bottom: 1px solid #ebeef5;
    display: flex;
    justify-content: space-between;
    align-items: center;

    .header-title {
      font-size: 16px;
      font-weight: 600;
      color: #303133;
      display: flex;
      align-items: center;
      gap: 8px;

      .el-icon {
        font-size: 18px;
        color: #409eff;
      }
    }

    .add-button {
      padding: 8px 20px;
      font-weight: 500;
      transition: all 0.3s;

      &:hover {
        transform: translateY(-2px);
      }
    }
  }

  .data-table {
    margin: 20px;
    
    :deep(.el-table__header) {
      th {
        background-color: #f5f7fa;
        color: #606266;
        font-weight: 600;
        height: 50px;
      }
    }

    :deep(.el-table__row) {
      td {
        padding: 12px 0;
        transition: all 0.3s;
      }

      &:hover {
        td {
          background-color: #f5f7fa;
        }
      }
    }

    .location-code {
      font-family: Monaco, Menlo, Consolas, monospace;
      color: #409eff;
      font-weight: 500;
    }

    .location-name {
      font-weight: 500;
      color: #303133;
    }

    .numeric-value {
      font-family: Monaco, Menlo, Consolas, monospace;
      color: #67c23a;
      font-weight: 500;
    }

    .location-coordinates {
      display: flex;
      gap: 8px;
      justify-content: flex-start;
      align-items: center;

      .el-tag {
        font-family: Monaco, Menlo, Consolas, monospace;
      }
    }

    .remarks {
      color: #606266;
      cursor: pointer;

      &:hover {
        color: #409eff;
      }
    }

    .no-remarks {
      color: #909399;
      font-style: italic;
    }

    .operation-buttons {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 8px;

      .el-button {
        padding: 4px 8px;
        transition: all 0.3s;

        &:hover {
          transform: translateY(-2px);
        }
      }

      .el-divider {
        margin: 0;
      }
    }

    .freeze-switch {
      :deep(.el-switch__label) {
        color: #606266;
        font-size: 12px;
      }

      &:deep(.el-switch.is-checked .el-switch__core) {
        background-color: #f56c6c;
        border-color: #f56c6c;
      }
    }
  }
}

.pagination-container {
  padding: 20px;
  border-top: 1px solid #ebeef5;
  display: flex;
  justify-content: flex-end;
}

.custom-dialog {
  :deep(.el-dialog__header) {
    margin: 0;
    padding: 20px;
    border-bottom: 1px solid #ebeef5;
    background-color: #f5f7fa;

    .el-dialog__title {
      font-size: 18px;
      font-weight: 600;
      color: #303133;
    }
  }

  :deep(.el-dialog__body) {
    padding: 24px;
  }

  :deep(.el-dialog__footer) {
    padding: 16px 24px;
    border-top: 1px solid #ebeef5;
    background-color: #f5f7fa;
  }
}

.custom-form {
  .form-section {
    margin-bottom: 24px;
    padding: 16px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;

    &:hover {
      box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.1);
    }

    .section-title {
      margin-bottom: 16px;
      font-size: 16px;
      font-weight: 600;
      color: #303133;
      display: flex;
      align-items: center;
      gap: 8px;

      &::before {
        content: '';
        width: 4px;
        height: 16px;
        background-color: #409eff;
        border-radius: 2px;
      }
    }
  }

  :deep(.el-form-item__label) {
    font-weight: 500;
    color: #606266;
  }

  :deep(.el-input__wrapper),
  :deep(.el-textarea__wrapper) {
    box-shadow: 0 0 0 1px #dcdfe6 inset;
    transition: all 0.3s;

    &:hover {
      box-shadow: 0 0 0 1px #409eff inset;
    }

    &.is-focus {
      box-shadow: 0 0 0 1px #409eff inset;
    }
  }

  :deep(.el-input-number__wrapper) {
    box-shadow: 0 0 0 1px #dcdfe6 inset;
    transition: all 0.3s;

    &:hover {
      box-shadow: 0 0 0 1px #409eff inset;
    }
  }

  .custom-radio {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.3s;

    &:hover {
      background-color: #f5f7fa;
    }

    .radio-icon {
      margin-right: 4px;
      font-size: 16px;
    }
  }

  .status-switch {
    :deep(.el-switch__label) {
      color: #606266;
      font-size: 13px;
    }

    &:deep(.el-switch.is-checked .el-switch__core) {
      background-color: #f56c6c;
      border-color: #f56c6c;
    }
  }
}

.dialog-footer {
  text-align: right;
  padding-top: 16px;

  .el-button {
    padding: 8px 20px;
    font-weight: 500;
    transition: all 0.3s;

    &:hover {
      transform: translateY(-2px);
    }
  }
}

:deep(.el-button) {
  .el-icon {
    margin-right: 4px;
  }
}
</style>
